<template>
<div class="main">
  <div>{{all_myrest_QueryKnowledgeGroup==null?'':''}}</div>
  <div>{{all_myrest_QueryHome==null?'':''}}</div>
  <!--<div>{{homeClassifyList==null?'':''}}</div>-->
  <!--<div>wendaData::::{{wendaData}}</div>-->
  <!--<div>vedioData:>>>>>>>>>>>>>>>>>>>>{{vedioData}}</div>-->
  <!--<div class="header">-->
    <!--<div class="header_tit">知识问答</div>-->
    <!--<a href="../newindex.html"> <div class="goback"><img src="../assets/images/gobackbtn.png" /></div></a>-->
    <!--<div class="header_yigou">已购课程</div>-->
  <!--</div>-->

  <div class="youxuan">
    <div class="youx_pic"><img src="../assets/images/wendaClassifyBanner.png" /> </div>
  </div>

  <div class="ke_nav clear">
      <div class="nav_item" v-for="tagClassify in homeClassifyList">
          <router-link :to="{path:'/Buy'+ '/'+tagClassify.id }">
          <!--&lt;!&ndash;<a href="buy.html">&ndash;&gt;  wendaicon    icon_text_ganggutong-->
              <div class="item_icon"><img v-bind:src="tagClassify.tagIconUrl" /> </div>
              <!--<div class="item_icon"><img v-bind:src="'../static/icon_text_guijianshu.png'" /> </div>-->
              <div class="item_tit">{{tagClassify.name}}</div>
          <!--</a>-->
          </router-link>
      </div>
      <!--<div class="nav_item">-->
          <!--<a href="spkc.html">-->
              <!--<div class="item_icon"><img src="../assets/images/wendaicon.png" /> </div>-->
              <!--<div class="item_tit">外汇学堂</div>-->
          <!--</a>-->
      <!--</div>-->
      <!--<div class="nav_item">-->
          <!--<div class="item_icon"><img src="../assets/images/wendaicon.png" /> </div>-->
          <!--<div class="item_tit">贵金属学堂</div>-->
      <!--</div>-->
      <!--<div class="nav_item">-->
          <!--<div class="item_icon"><img src="../assets/images/wendaicon.png" /> </div>-->
          <!--<div class="item_tit">商品学堂</div>-->
      <!--</div>-->
  </div>

  <div class="wenda">

    <!---列表模块--知识问答--->

    <div class="list_module">
        <div class="wenda_tit">优选好课</div>
        <div class="wenda_item_list clear" id="wenda_item_list">
            <div class="wenda_item" v-for="item in wendaData">
                <router-link :to="{path:'/WendaPreview'+ '/' + item.id}">
                <!--<a v-bind:href="'/#/WendaPreview?groupId='+item.id">-->
                    <div class="item_pic"><img v-bind:src="item.cover" /> </div>
                    <div class="item_tit">{{item.title}}</div>
                    <div class="item_price_info">
                        <div class="money_icon"><img src="../assets/images/money_icon.png" /> </div>
                        <div class="jf_num">{{item.buyReward}}</div>
                        <div class="price">￥<span>{{(item.price)/100}}</span></div>
                    </div>
                <!--</a>-->
                </router-link>
            </div>
        </div>
    </div>

    <!---列表模块--视频学堂--->
   <!-- <div class="list_module">
      <div class="wenda_tit">视频 · 学堂</div>
      <div class="wenda_item_list clear" id="shipin_item_list">
        <div class="wenda_item" v-for="shipin in vedioData">
          <a v-bind:href="'preview.html?groupId='+shipin.id">
            <div class="item_pic"><img v-bind:src="shipin.cover" /> </div>
            <div class="item_tit">{{shipin.title}}</div>
            <div class="item_price_info">
              <div class="money_icon"><img src="../assets/images/money_icon.png" /> </div>
              <div class="jf_num">{{shipin.buyReward}}</div>
              <div class="price">￥<span>{{(shipin.price)/100}}</span></div>
            </div>
          </a>
        </div>
      </div>
    </div>-->

  </div>
</div>

</template>

<script>
  import stores from './mystore.js'
  import Vue from 'vue';
  import { XButton, XInput,Group, Tab, TabItem } from 'vux'
  import { mapGetters,mapActions } from 'vuex'
  import sha1 from 'js-sha1'

  export default {
    data(){
      return {
          homeClassifyList:[],
          jincheng:1,
          wendaData:'',
          vedioData:'',
          successMsg:"",
          items:[1,2,3,4,5],
          mypayload:{
              url:'baseapi',
              actionName:"QueryKnowledgeGroup",
              postData: {
                  "haveVideo":"false",
                  "pageNo":1,
                  "pageSize":4
              }
          },

          queryHomePayload:{
              url:'baseapi',
              actionName:"QueryHome",
              postData: {
                  //"haveVideo":"false",
                  //"pageNo":1,
                  //"pageSize":4
              }
          },

      }
    },

    computed:{
      all_myrest(){
        //return this.$store.getters.all_restful
      },
      all_myrest_QueryKnowledgeGroup(){
        var dataval=this.$store.getters.all_restful_QueryKnowledgeGroup;
        var testData={"myname":"dongguang"}
        if(dataval){
          console.log("dataval.body::::::::::::::::::::::::::::"+dataval.body)
          this.wendaData=dataval.body.knowledgeGroupList;
          //console.log("title::::::::::::::"+this.wendaData[0].title)
          //this.queryHome();
          return dataval.body.knowledgeGroupList
        }else{
          return null
        }
        //return dataval;
      },
      all_myrest_QueryHome(){
          var dataval=this.$store.getters.all_restful_QueryHome;
          if(dataval){
              this.homeClassifyList=dataval.body.classifyList;
              for(var i=0;i<this.homeClassifyList.length;i++){
                  if(this.homeClassifyList[i].name=='贵金属学堂'){
                      this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_guijianshu.png"
                  }else if(this.homeClassifyList[i].name=='商品学堂'){
                      this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_yuanyou.png"
                  }else if(this.homeClassifyList[i].name=='外汇学堂'){
                      this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_waihui.png"
                  }else if(this.homeClassifyList[i].name=='K线分析'){
                    this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_kxian.png"
                  }else if(this.homeClassifyList[i].name=='美股'){
                    this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_meigu.png"
                  }else if(this.homeClassifyList[i].name=='港股通'){
                    this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_ganggutong.png"
                  }else if(this.homeClassifyList[i].name=='融资融券'){
                    this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_rongzi.png"
                  }else{
                    this.homeClassifyList[i].tagIconUrl="http://m.lep365.com/tagiconimg/icon_text_rongzi.png"
                  }
              }
              return dataval.body.classifyList;
          }else{
              //alert("null::::all_myrest_QueryHome")
              return null
          }
          //return dataval;
      },
      all_nots(){
        //return this.$store.getters.all_nots
      },
      all_login(){
        //return this.$store.getters.all_login
      },
      ...mapGetters([ 'evenOrOdd'
      ])
    },
    created (){
      this.cntReady();
      //this.queryHome();
      this.setTimeoutTest();
    },

    methods:{
      dosth (){
        //this.$store.commit('restful_api',this.mypayloadvideo)
      },
      setTimeoutTest:function(){
        let that=this;
        setTimeout(function(){
          that.$store.commit('restful_api',that.queryHomePayload)
        },200)
      },
      queryHome(){
       // alert("queryHome")
        //this.$store.commit('restful_api',this.queryHomePayload)
      },
      cntReady(){
        //alert("cntReady")
        this.$store.commit('restful_api',this.mypayload);
        //alert(2)
      },

      ...mapActions([
        'increment',
        'decrement',
        'incrementIfOdd'
      ]),
    },
    components: { XButton, Group, XInput, Tab, TabItem }

  }

</script>

<style scoped>
  *{ margin: 0; padding: 0;}
  body{ background-color: #eee;}
  a{ text-decoration: none; color: #000;}
  .clear:after{ display: block; clear: both; content: ''; height: 0;}
  div img{ width: 100%; display: block;}

  /*** 顶部 header ***/
  .main{ background-color: #eee;}
  .header{ background-color: #f5f5f5; border-bottom: 1px solid #e5e5e5; position: relative; padding: 15px 0;}
  .header_tit{ text-align: center; font-weight: bold; font-size: 18px; }
  .goback{ width: 20px; position: absolute; left: 20px; top:16px;}
  .goback img{ width: 13px;}
  .header_yigou{ position: absolute; right: 20px; top:16px; color: #828b93; font-size: 14px;}

  /*** 顶部 分类导航 ***/
  .ke_nav{ background-color: #fff; _display: box; _display: -webkit-box; padding: 15px 0 5px 0;}
  .nav_item{ -webkit-box-flex: 1; width: 25%; float: left; padding-bottom: 10px;}
  .item_icon{ width: 28px; height: 24px; overflow: hidden; margin: 0 auto; margin-bottom: 10px;}
  .item_tit{ text-align: center; font-size: 12px;}

  /*** 优选推荐 ***/
  .youxuan{ background-color: #fff; }
  .youx_tit{ text-align: center; padding: 10px 0;}

  .wenda{ margin-top: 10px; padding: 0px;}
  .list_module{ background-color: #fafafa; margin-bottom: 10px; }
  .wenda_tit{ font-size: 14px; position: relative; padding: 10px 15px;}
  .wenda_item{ float:left; width: 50%; box-sizing: border-box; -webkit-box-sizing:border-box; padding: 0 10px; margin-bottom: 15px;}
  .wenda_item .item_tit{ text-align: left; margin: 5px 0;}
  .item_price_info{ display: box; display: -webkit-box; font-size: 12px;}
  .item_price_info div{  box-sizing: border-box; -webkit-box-sizing:border-box;}
  .money_icon{ width: 13px; padding-top: 3px; }
  .jf_num{ -webkit-box-flex: 1; color: #999; margin-left: 5px;}
  .price{ width: 80px; text-align: right;}








</style>






